//package com.product.system.service.impl;
//
//import cn.hutool.core.lang.tree.Tree;
//import cn.hutool.core.lang.tree.TreeNodeConfig;
//import cn.hutool.core.lang.tree.TreeUtil;
//import com.product.system.domain.ArgpTradesmanCity;
//import com.product.system.mapper.ArgpTradesmanCityMapper;
//import com.product.system.service.ArgpTradesmanCityService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class ArgpTradesmanCityServiceImpl implements ArgpTradesmanCityService {
//
//    @Autowired
//    private ArgpTradesmanCityMapper argpTradesmanCityMapper;
//
//    public List<ArgpTradesmanCity> selectCity(){
//        return argpTradesmanCityMapper.selectCity();
//    }
//
//    @Override
//    public List<Tree<Object>> listCityTree() {
//        TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
//        treeNodeConfig.setIdKey("id");
//        treeNodeConfig.setNameKey("name");
//        treeNodeConfig.setDeep(4);
//        treeNodeConfig.setParentIdKey("parentId");
//        treeNodeConfig.setChildrenKey("children");
//        List<ArgpTradesmanCity> city = selectCity();
//        List<Tree<Object>> build = TreeUtil.build(city, 1, treeNodeConfig, (treeNode, tree) -> {
//            tree.setId(treeNode.getId());
//            tree.setName(treeNode.getCityName());
//            tree.setParentId(treeNode.getPid());
//            // 设置其他属性
//            tree.putExtra("type", treeNode.getType());
//        });
//        return build;
//    }
//}
